package com.example.design.factory.abstr;


import com.example.design.factory.Car;

/**
 * @author ebnew
 */
public abstract class AbstractFactory {
	/**
	 *
	 * @return
	 */
 	protected abstract Car getCar();

 	public Car getCar(String name){
		if("BMW".equalsIgnoreCase(name)){
			return new BmwFactory().getCar();
		}else if("Benz".equalsIgnoreCase(name)){
			return new BenzFactory().getCar();
		}else if("Audi".equalsIgnoreCase(name)){
			return new AudiFactory().getCar();
		}else{
			System.out.println("这个产品产不出来");
			return null;
		}
	}

}
